package com.project;

import com.project.bean.UserBean;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * @Title: UserController
 * @Package: com.project.controller
 * @Description:
 * @Author: Liang-Xie
 * @Date: 2022/6/22 - 14:01
 */
@SuppressWarnings("all")
@RestController
@RequestMapping("user")
public class UserController {
    @RequestMapping("land")
    public String login(@RequestParam("name") String userName, String pwd, UserBean user){
        System.out.println(userName+" "+pwd+" "+user);
        if ("张三".equals(userName)&&"333".equals(pwd)){
            return "LoginSuccesful";
        }
        else {
            return "LoginFail";
        }
    }
    @RequestMapping("add" )
    public String add(UserBean user){
        System.out.println(user);
        return "添加成功";
    }
    @RequestMapping("del/{userId}")
    public String del(@PathVariable("userId") int id){
        return "删除编号"+id;
    }
    @RequestMapping("/update")
    public String update(@RequestParam(value="id",defaultValue = "0") int id, HttpServletRequest request, HttpServletResponse response){
        return "修改"+id;
    }

}
